<%@page pageEncoding = "utf-8" contentType = "text/html;charset=utf-8"%>

<%@taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions"%>

<script type="text/javascript">
var fromRegistrationDate, toRegistrationDate, fromEndDate, toEndDate;
window.onload = function () {
  fromStartDate  = new Epoch('fromStartDate','popup',document.getElementById('fromStartDate'));
  toStartDate  = new Epoch('toStartDate','popup',document.getElementById('toStartDate'));
  fromEndDate  = new Epoch('fromEndDate','popup',document.getElementById('fromEndDate'));
  toEndDate  = new Epoch('toEndDate','popup',document.getElementById('toEndDate'));
};
</script>

<h2>Поиск задач</h2>

<div class = "messages"><jsp:include page = "/messages.jsp"/></div>

<div id="box">

<!-- start search form -->
<form action="${sessionScope.alias}" method="get" name="taskSearchForm">

<table width="100%">
   <tr>
     <td>     
     
     <table class = "form">     
      <tr>
        <td class="label">Идентификатор задачи</td>
        <td><input name="id_query" value="<c:out value='${param["id_query"]}'/>"></td>
      </tr>
     
      <tr>
         <td class = "label"><fmt:message key = "task.text"/></td>
         <td>
            <input name="text_query" value='<c:out value="${param['text_query']}"/>'>
         </td>
      </tr>
      
      <tr>
         <td class = "label"><fmt:message key = "task.status"/></td>
         <td>
            <select name="status_query">
              <c:forEach var = "status" items = "${statusList}">
                <option value="${status.id}" 
                  ${status.id == param["status_query"] ? "selected" : ""}>${status.status}
                </option>
              </c:forEach> 
            </select>
         </td>
      </tr>
  </table>
  </td>
     
  <td>
     <table class = "form">
     <tr><td colspan="4">Дата регистрации:</td></tr>     
     <tr>
         <td class = "label">От:</td>
         <td>
          <input 
            id="fromStartDate" 
            type="text" 
            name="fromStartDate" 
            value='<fmt:formatDate value="${fromStartDate}" pattern="dd.MM.yyyy"/>'
            style="width: 110px;"
          >
         </td>
         <td class = "label">До:</td>
         <td>
          <input 
            id="toStartDate" 
            type="text" 
            name="toStartDate" 
            value='<fmt:formatDate value="${toStartDate}" pattern="dd.MM.yyyy"/>'
            style="width: 110px;"
          >
         </td>
      </tr>
                
     <tr><td colspan="4">Дата выполнения:</td></tr>
     <tr>
         <td class = "label">От:</td>
         <td>
          <input 
            id="fromEndDate" 
            type="text" 
            name="fromEndDate" 
            value='<fmt:formatDate value="${fromEndDate}" pattern="dd.MM.yyyy"/>'
            style="width: 110px;"
          >          
         </td>
         
         <td class = "label">До:</td>
         <td>
          <input 
            id="toEndDate" 
            type="text" 
            name="toEndDate" 
            value='<fmt:formatDate value="${toEndDate}" pattern="dd.MM.yyyy"/>'
            style="width: 110px;"
          >
         </td>
      </tr>
    
     </table>
     </td>
   </tr>
</table>
   
<input type="hidden" name="_action" value="processTaskSearchForm">

<input type="submit" class="btn" value="Найти">

</form><!-- end search form -->
</div>